<?php
namespace App\Services;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Cache;
use GuzzleHttp\Client;
use App\Models\Memberorder;
use Config,Log;

class MemberService
{
    public static function userMemberParamas($openid)
    {
        $member = Memberorder::userLastMember($openid);
        if (empty($member) || $member->end_time <= time()) {
            $limit_pv = 100;
            $end_time = time() + 3600;
            $count = 3;
            $product_id = 0;
        } else {
            if ($member->product_id == 1) {
                $limit_pv = 50000;
            } elseif ($member->product_id == 2) {
                $limit_pv = 300000;
            } else {
                $limit_pv = 1000000;
            }
            $count = 10000;
            $product_id = $member->product_id;
            $end_time = $member->end_time;
        }
        return ["status"=>"success","message"=>"","limit_pv"=>$limit_pv,"end_time"=>$end_time,"count"=>$count,"product_id"=>$product_id];
    }
}
